package jiejie.jianzhioffer;

public class offer24 {
    public static void main(String[] args) {

    }
    /**
     * 链表反转
     * @param head
     * @return
     */
    public ListNode reverseList(ListNode head) {
        if(head==null||head.next==null)
            return head;
        ListNode pNode=null;
        ListNode cNode=head;
        while(cNode!=null){
            ListNode nNode=cNode.next;
            cNode.next=pNode;
            pNode=cNode;
            cNode=nNode;
        }
        return pNode;
    }
}